<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>NULL handling when using variables: GNOME Data Access 5 manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GNOME Data Access 5 manual">
<link rel="up" href="ch04.html" title="Foreword about abstraction">
<link rel="prev" href="ch04.html" title="Foreword about abstraction">
<link rel="next" href="gen_sql_identifiers.html" title="SQL identifiers">
<meta name="generator" content="GTK-Doc V1.32 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch04.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ch04.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gen_sql_identifiers.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="null_handling"></a>NULL handling when using variables</h2></div></div></div>
<p>
	  When using variables in statements (see <a class="link" href="ch04.html#placeholders" title="Variables syntax in SQL">Variables syntax in SQL</a>)
	  for example like </p>
<pre class="programlisting">SELECT * FROM users WHERE name = ##name::string::null;</pre>
<p>,
	  database engines will generally not handle correctly the case where a variable is valued to NULL. For instance
	  this example would result in the code being executed as </p>
<pre class="programlisting">SELECT * FROM users WHERE name = NULL;</pre>
<p> which would probably give no result, whereas the expected equivalent code would be
	  </p>
<pre class="programlisting">SELECT * FROM users WHERE name IS NULL;</pre>
<p>
	</p>
<p>
	   <span class="application">Libgda</span> automatically handles theses cases and makes sure the <code class="code">IS NULL</code> or <code class="code">IS NOT NULL</code>
	   constructions are used when necessary. It won't of course handle variable's NULL values when using other
	   operators that equal or different, tough.
	</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.32</div>
</body>
</html>